<p style=\"font-size: 12px;\"><br></p>
<div style=\"color: rgb(171, 178, 191); background-color: rgb(40, 44, 52);overflow-x: auto; width:100%; font-family:
	Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;\">
	<div><span style=\"color: #c678dd;\"></span></div>
	<div><span style=\"color: #c678dd;\"><i style='color:#c678dd'>let</i></span> arr <span style=\"color:
			#56b6c2;\">=</span> [</div>
	<div> <span style=\"color: #d19a66;\">1</span>, <span style=\"color: #d19a66;\">2</span>, <span style=\"color:
			#d19a66;\">3</span>, <span style=\"color: #d19a66;\">5</span>, <span style=\"color: #d19a66;\">12</span>
	</div>
	<div>]</div>
	<div><span style=\"color: #c678dd;\"><i style='color:#c678dd'>let</i></span> newArr <span style=\"color:
			#56b6c2;\">=</span> arr.<span style=\"color: #61afef;\">reduce</span>((val, item) <span style=\"color:
			#c678dd;\">=&gt;</span> val <span style=\"color: #56b6c2;\">+</span> item, <span style=\"color:
			#d19a66;\">0</span>)</div>
	<div>console.<span style=\"color: #61afef;\">log</span>(newArr); <span style=\"color: #5c6370;font-style:
			italic;\">//打印出来的23</span></div>
	<div><span style=\"color: rgb(198, 120, 221);\">```</span><br></div>
</div>
<p style=\"text-align: center;\">(数组累加的简单应用)</p>
<div style=\"color: rgb(171, 178, 191); background-color: rgb(40, 44, 52);overflow-x: auto; width:100%; font-family:
	Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;\">
	<div><span style=\"color: #c678dd;\"></span></div>
	<div><span style=\"color: #c678dd;\"><i style='color:#c678dd'>let</i></span> fruitList <span style=\"color:
			#56b6c2;\">=</span> [</div>
	<div> {<span style=\"color: #e06c75;\">name</span><span style=\"color: #56b6c2;\">:</span> <span style=\"color:
			#98c379;\">\"西瓜\"</span>,<span style=\"color: #e06c75;\">weight</span><span style=\"color:
			#56b6c2;\">:</span> <span style=\"color: #d19a66;\">320</span>},</div>
	<div> {<span style=\"color: #e06c75;\">name</span><span style=\"color: #56b6c2;\">:</span> <span style=\"color:
			#98c379;\">\"橘子\"</span>,<span style=\"color: #e06c75;\">weight</span><span style=\"color:
			#56b6c2;\">:</span> <span style=\"color: #d19a66;\">320</span>},</div>
	<div> {<span style=\"color: #e06c75;\">name</span><span style=\"color: #56b6c2;\">:</span> <span style=\"color:
			#98c379;\">\"苹果\"</span>,<span style=\"color: #e06c75;\">weight</span><span style=\"color:
			#56b6c2;\">:</span> <span style=\"color: #d19a66;\">200</span>},</div>
	<div> {<span style=\"color: #e06c75;\">name</span><span style=\"color: #56b6c2;\">:</span> <span style=\"color:
			#98c379;\">\"香蕉\"</span>,<span style=\"color: #e06c75;\">weight</span><span style=\"color:
			#56b6c2;\">:</span> <span style=\"color: #d19a66;\">520</span>}</div>
	<div>]</div>
	<div><span style=\"color: #c678dd;\"><i style='color:#c678dd'>let</i></span> total_weight<span style=\"color:
			#56b6c2;\">=</span> fruitList.<span style=\"color: #61afef;\">reduce</span>((val, item) <span style=\"color:
			#c678dd;\">=&gt;</span> val <span style=\"color: #56b6c2;\">+</span> item.<span style=\"color:
			#e06c75;\">weight</span>, <span style=\"color: #d19a66;\">0</span>)</div>
	<div>console.<span style=\"color: #61afef;\">log</span>(total_weight <span style=\"color: #56b6c2;\">+</span> <span
			style=\"color: #98c379;\">\"kg\"</span>); <span style=\"color: #5c6370;font-style:
			italic;\">//打印出来的1360kg</span></div>
	<div><span style=\"color: rgb(198, 120, 221);\">```</span><br></div>
</div>
<p style=\"text-align: center;\">(小案例，计算水果的总重量)</p>
<p style=\"text-align: left;\"><br></p>
<p style=\"text-align: left;\"><br></p>
<style>
	* {
		margin: 0px;
		padding: 0px;
	}

	html {
		font-size: calc(100vw/750*2);
		width: 100%;
	}

	body {
		font-size: 16rem;
	}
</style>